import 'package:fluro/fluro.dart';
import 'package:fluro_decorate/fluro_decorate.dart';
import 'package:flutter/cupertino.dart';

///
/// @ProjectName:    fluro_decorate
/// @Package:        
/// @ClassName:      page_builder
/// @Description:    dart文件作用 
/// @Author:         WTT
/// @CreateDate:     2021/10/27 3:59 下午

typedef Widget HandlerFunc(BuildContext context, Map<String, List<String>> params);
typedef Widget PageBuilderFunc(Bundle bundle);

class PageBuilder{

  final PageBuilderFunc builder;

  HandlerFunc _handlerFunc;

  PageBuilder({this.builder}){
    this._handlerFunc = (context, _) {
      return this.builder(ModalRoute.of(context).settings.arguments as Bundle);
    };
  }

  /// 获取handler实例
  Handler getHandler() {
    return Handler(handlerFunc: _handlerFunc);
  }

}